
window.onload=function(){

    //屏蔽右键菜单 
document.oncontextmenu = function(event) { 
    if (window.event) { 
    } 
    try { 
        var the = event.srcElement; 
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { 
            return false; 
        } 
        return true; 
    } catch (e) { 
        return false; 
    } 
    // return false;
} 




 
//屏蔽粘贴 
document.onpaste = function(event) { 
    if (window.event) { 
        event = window.event; 
    } 
    try { 
        var the = event.srcElement; 
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { 
            return false; 
        } 
        return true; 
    } catch (e) { 
        return false; 
    } 
    // return false;
} 
 





//屏蔽复制 
document.oncopy = function(event) { 
    if (window.event) { 
        event = window.event; 
    } 
    try { 
        var the = event.srcElement; 
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { 
            return false; 
        } 
        return true; 
    } catch (e) { 
        return false; 
    }
    // return false;

} 







//屏蔽剪切 
document.oncut = function(event) { 
    if (window.event) { 
        event = window.event; 
    } 
    try { 
        var the = event.srcElement; 
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { 
            return false; 
        } 
        return true; 
    } catch (e) { 
        return false; 
    } 
    // return false;

} 







//屏蔽选中 
document.onselectstart = function(event) { 
    if (window.event) { 
        event = window.event; 
    } 
    try { 
        var the = event.srcElement; 
        if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { 
            return false; 
        } 
        return true; 
    } catch (e) { 
        return false; 
    } 
    // return false;

}







// 禁止按键操作
window.addEventListener('keydown', function (e) {

    // 禁止F12
    if(e && e.keyCode == 123) {
        e.keyCode=0;
        e.returnValue=false;
    }
    if(e && e.keyCode == 13) {
        e.keyCode = 505;
    }
    if(e && e.keyCode == 8) {
        e.returnValue=false;
    }
    if(e && e.keyCode == 121) {
        e.returnValue=false;
    }
    

    // 禁止ctrl+U
    if(e.keyCode == 85 && (navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey)){
        e.preventDefault();
    }

    // 禁止ctrl+S
    if(e.keyCode == 83 && (navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey)){
        e.preventDefault();
    }
})









 }

 
 

 
  

 
 




